package com.cy.sca.member.controller;

//import com.cy.sca.member.annotation.RequiredLog;
import com.cy.sca.api.annotation.RequiredLog;
import com.cy.sca.api.feign.RemoteNoticeService;
import com.cy.sca.member.domain.LoginVo;
import com.cy.sca.member.domain.Member;
//import com.cy.sca.member.feign.RemoteNoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName MemberController
 * @Description:类描述
 * @Author Tedu
 * @Date 2021/6/9 8:38
 * @Version V1.0
 **/
@RestController
@RequestMapping(value ="/member/")
public class MemberController {
    /*基于此接口中的方法进行远程通知服务(sms mail)的调用*/
    @Autowired
    private RemoteNoticeService remoteNoticeService;
    @Value("${server.port}")
    private String server;

    @PostMapping
    public String doRegist(@RequestBody Member member){
        Map<String,Object> map = new HashMap<>();
        map.put("mobile", "13313313313");
        map.put("code", "1234");
        remoteNoticeService.sendMsg(map);
        System.out.println(server+" do regist"+member+new Date());
        return "regist ok";
    }
    @RequiredLog
    @PostMapping("doLogin")
    public String doLogin(@RequestBody LoginVo loginVo){
       // long t1 = System.nanoTime();
        System.out.println(loginVo);
       // long t2 = System.nanoTime();
        return "login ok";

    }
}
